/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entite;

import connexion.Connexion;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 *
 * @author asall
 */
public class ValidationHistorique {
   static Connexion con= new Connexion();
    public String getStatut(int idDiplome) {
        String res="statut ";
		try {
			Statement req = con.getInstance().createStatement();

                        ResultSet resultatDest = req.executeQuery("select va.statut"
                                + " from diplome di, validation_historique va"
                                + " where di.id_dip=va.fid_dip and di.id_dip= "+ idDiplome );
			while (resultatDest.next()) {
				res=(resultatDest.getString("statut"));
				return res;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
    }

    public String getDate(int idDiplome) {
        String res="date validation ";
		try {
			Statement req = con.getInstance().createStatement();

                        ResultSet resultatDest = req.executeQuery("select va.d_validation"
                                + " from diplome di, validation_historique va"
                                + " where di.id_dip=va.fid_dip and di.id_dip= "+ idDiplome );
			while (resultatDest.next()) {
				res=(resultatDest.getString("d_validation"));
				return res;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
    
    }

    public String getNumResponsable(int idDiplome) {
       String res="code ";
		try {
			Statement req = con.getInstance().createStatement();

                        ResultSet resultatDest = req.executeQuery("select per.num_harpege"
                                + " from diplome di, validation_historique va,personnel per"
                                + " where di.id_dip=va.fid_dip and va.fid_validateur=per.id_pers"
                                + " and di.id_dip= "+ idDiplome );
			while (resultatDest.next()) {
				res=(resultatDest.getString("num_harpege"));
				return res;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
    }

    public String getNomResponsable(int idDiplome) {
        String res="nom ";
		try {
			Statement req = con.getInstance().createStatement();

                        ResultSet resultatDest = req.executeQuery("select per.nom"
                                + " from diplome di, validation_historique va,personnel per"
                                + " where di.id_dip=va.fid_dip and va.fid_validateur=per.id_pers"
                                + " and di.id_dip= "+ idDiplome );
			while (resultatDest.next()) {
				res=(resultatDest.getString("nom"));
				return res;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
    }

    public String getPrenomResponsable(int idDiplome) {
       String res="prenom";
		try {
			Statement req = con.getInstance().createStatement();

                        ResultSet resultatDest = req.executeQuery("select per.prenom"
                                + " from diplome di, validation_historique va,personnel per"
                                + " where di.id_dip=va.fid_dip and va.fid_validateur=per.id_pers"
                                + " and di.id_dip= "+ idDiplome );
			while (resultatDest.next()) {
				res=(resultatDest.getString("prenom"));
				return res;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
    }

    public String getCodeUfrResponsable(int idDiplome) {
         String res="code ";
		try {
			Statement req = con.getInstance().createStatement();

                        ResultSet resultatDest = req.executeQuery("select cp.code_apogee"
                                + " from diplome di, validation_historique va,personnel per,composante cp"
                                + " where di.id_dip=va.fid_dip and va.fid_validateur=per.id_pers"
                                + " and cp.id_comp=per.fid_comp and di.id_dip= "+ idDiplome );
			while (resultatDest.next()) {
				res=(resultatDest.getString("code_apogee"));
				return res;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;

    }

    public String getNomUfrResponsable(int idDiplome) {
       String res="nom long ufr ";
		try {
			Statement req = con.getInstance().createStatement();

                        ResultSet resultatDest = req.executeQuery("select cp.libelle_long"
                                + " from diplome di, validation_historique va,personnel per,composante cp"
                                + " where di.id_dip=va.fid_dip and va.fid_validateur=per.id_pers"
                                + " and cp.id_comp=per.fid_comp and di.id_dip= "+ idDiplome );
			while (resultatDest.next()) {
				res=(resultatDest.getString("libelle_long"));
				return res;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
    }

    public String getNomCourtUfrResponsable(int idDiplome) {
        String res="nom court ";
		try {
			Statement req = con.getInstance().createStatement();

                        ResultSet resultatDest = req.executeQuery("select cp.libelle_court"
                                + " from diplome di, validation_historique va,personnel per,composante cp"
                                + " where di.id_dip=va.fid_dip and va.fid_validateur=per.id_pers"
                                + " and cp.id_comp=per.fid_comp and di.id_dip= "+ idDiplome );
			while (resultatDest.next()) {
				res=(resultatDest.getString("libelle_court"));
				return res;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
    }
    
}
